<?php

namespace app\admin\controller;

use app\common\controller\Backend;
use think\facade\Db;

class Myapp extends Backend
{
    public function initialize(): void
    {
        parent::initialize();
    }

    public function index(): void
    {
        $auth_appid = Db::name('app_authorization')->where('status', '1')->where('adminid', $this->auth->id)->column('appid');
        $auth_accounts =    Db::name('app_account')->field('a.appaccount,a.apppassword,a.rolename,b.*')->alias('a')->join('app_app b', 'a.appid = b.id')->where('appid', 'in', $auth_appid)->where('adminid', $this->auth->id)->where('b.status', '1')->select()->toArray();
        foreach ($auth_accounts as $key => &$value) {
            
            $value['iconimage'] = $this->request->domain() . $value['iconimage'];
        }
        $this->success('',  $auth_accounts);
    }
}
